﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

using Skyhook.Core;
using Skyhook.Core.Screens;
using Skyhook.Core.Graphics;
using Skyhook.Core.Input;
using Skyhook.Resources;

namespace Tanks.Screens
{
    class TestScreen : GameScreen
    {
        SpriteBatch SpriteBatch = null;
        SpriteFont Font = null;

        public TestScreen(GameScreenManager screenmanager)
            : base(screenmanager)
        {
            IsPopup = false;
        }

        protected override void LoadContent()
        {
            TransitionOnTime = TimeSpan.FromSeconds(1.0);
            TransitionOffTime = TimeSpan.FromSeconds(1.0);

            SpriteBatch = GraphicsFactory.CreateSpriteBatch();
            Font = ResourceFactory.CreateFromFile<Font>("bookman_32");
        }

        protected override void Update(GameTime time)
        {
        }

        protected override void Draw(GameTime time)
        {
            const string message = "Ололололо";

            Vector2 viewportsize = new Vector2(GraphicsManager.ViewportWidth, GraphicsManager.ViewportHeight);
            Vector2 textsize = Font.MeasureString(message);
            Vector2 textposition = (viewportsize - textsize) / 2;

            Color color = Color.White * TransitionPosition;

            SpriteBatch.Begin();
            SpriteBatch.DrawString(Font, message, textposition, color);
            SpriteBatch.End();
        }

        protected override void OnKeyPressed(Keys key)
        {
            switch (key)
            {
                case Keys.Escape:
                    Hide();
                    break;
            }
        }
    }
}
